// 图标选择器样式
// 全局样式，确保在外部项目中也能正确应用
.icon-selector-warp-row {
  height: 230px;
  overflow: hidden;
  border-radius: 6px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .icon-selector-warp-row {
    height: 160px;
  }
}

.icon-selector {
  width: 100%;
  height: 100%;
  position: relative;

  // 自定义输入框样式
  .custom-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.3s ease;
    overflow: hidden;

    &:hover {
      border-color: #c0c4cc;
    }

    &:focus-within {
      border-color: #409eff;
      box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
    }

    &.input-disabled {
      background-color: #f5f7fa;
      border-color: #e4e7ed;
      cursor: not-allowed;

      .custom-input {
        background-color: transparent;
        cursor: not-allowed;
        color: #c0c4cc;
      }

      .prepend-icon {
        color: #c0c4cc;
      }
    }

    // 不同尺寸
    &.input-small {
      height: 28px;
      font-size: 12px;

      .input-prepend {
        padding: 0 8px;
      }

      .custom-input {
        padding: 0 8px;
        font-size: 12px;
      }

      .input-clear {
        width: 20px;
        height: 20px;
        font-size: 12px;
      }
    }

    &.input-default {
      height: 32px;
      font-size: 14px;

      .input-prepend {
        padding: 0 12px;
      }

      .custom-input {
        padding: 0 12px;
        font-size: 14px;
      }

      .input-clear {
        width: 24px;
        height: 24px;
        font-size: 14px;
      }
    }

    &.input-large {
      height: 36px;
      font-size: 16px;

      .input-prepend {
        padding: 0 16px;
      }

      .custom-input {
        padding: 0 16px;
        font-size: 16px;
      }

      .input-clear {
        width: 28px;
        height: 28px;
        font-size: 16px;
      }
    }
  }

  .input-prepend {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f7fa;
    border-right: 1px solid #dcdfe6;
    color: #909399;
    height: 100%;

    .prepend-icon {
      font-size: 14px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }

  .custom-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #606266;
    font-family: inherit;

    &::placeholder {
      color: #c0c4cc;
    }

    &:disabled {
      cursor: not-allowed;
      color: #c0c4cc;
    }
  }

  .input-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #c0c4cc;
    transition: color 0.3s ease;
    border-radius: 50%;
    margin-right: 8px;

    &:hover {
      color: #909399;
      background-color: #f5f7fa;
    }

    &:focus {
      outline: 2px solid #409eff;
      outline-offset: 2px;
    }
  }

  .icon-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease-out;
  }

  @keyframes dropdownFadeIn {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .icon-tabs {
    display: flex;
    border-bottom: 1px solid #e4e7ed;
    background: #fafafa;

    .tab-item {
      flex: 1;
      padding: 12px 16px;
      text-align: center;
      cursor: pointer;
      font-size: 14px;
      color: #606266;
      border-bottom: 2px solid transparent;
      transition: all 0.3s ease;
      user-select: none;

      &:hover {
        color: #409eff;
        background-color: #f0f9ff;
      }

      &:focus {
        outline: 2px solid #409eff;
        outline-offset: -2px;
      }

      &.tab-active {
        color: #409eff;
        border-bottom-color: #409eff;
        background-color: #fff;
        font-weight: 500;
      }
    }
  }

  .icon-content {
    position: relative;
  }

  // 移除不再使用的 Element Plus 样式

  .icon-selector-warp-row {
    height: 230px !important;
    overflow: hidden;
    border-radius: 6px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

    .icon-scroll-container {
      height: 100%;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 10px;

      // 自定义滚动条样式
      &::-webkit-scrollbar {
        width: 6px;
      }

      &::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
      }

      &::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;

        &:hover {
          background: #a8a8a8;
        }
      }

      // Firefox 滚动条样式
      scrollbar-width: thin;
      scrollbar-color: #c1c1c1 #f1f1f1;
    }

    .icon-grid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
      padding: 0;
    }

    .icon-item {
      display: flex;
      justify-content: center;
      align-items: center;
      border: 1px solid #e4e7ed;
      border-radius: 5px;
      height: 40px;
      cursor: pointer;
      pointer-events: auto;
      user-select: none;
      transition: all 0.3s ease;
      background-color: #fff;

      i,
      .menu-icon-svg {
        font-size: 16px;
        color: #606266;
        pointer-events: none;
        transition: color 0.3s ease;
        width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      &:hover {
        cursor: pointer;
        background-color: #f0f9ff;
        border: 1px solid #b3d8ff;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

        i,
        .menu-icon-svg {
          color: #409eff;
        }
      }

      &:focus {
        outline: 2px solid #409eff;
        outline-offset: 2px;
      }
    }

    .icon-item-active {
      background-color: #f0f9ff;
      border: 1px solid #b3d8ff;

      i,
      .menu-icon-svg {
        color: #409eff;
      }
    }

    .icon-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      color: #909399;
      padding: 20px;

      .empty-icon {
        font-size: 48px;
        margin-bottom: 12px;
        opacity: 0.6;
      }

      .empty-text {
        font-size: 14px;
        text-align: center;
      }
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .icon-selector {
    .custom-input-wrapper {
      &.input-small {
        height: 26px;
        font-size: 11px;

        .input-prepend {
          padding: 0 6px;
        }

        .custom-input {
          padding: 0 6px;
          font-size: 11px;
        }

        .input-clear {
          width: 18px;
          height: 18px;
          font-size: 11px;
        }
      }

      &.input-default {
        height: 30px;
        font-size: 13px;

        .input-prepend {
          padding: 0 10px;
        }

        .custom-input {
          padding: 0 10px;
          font-size: 13px;
        }

        .input-clear {
          width: 22px;
          height: 22px;
          font-size: 13px;
        }
      }

      &.input-large {
        height: 34px;
        font-size: 15px;

        .input-prepend {
          padding: 0 14px;
        }

        .custom-input {
          padding: 0 14px;
          font-size: 15px;
        }

        .input-clear {
          width: 26px;
          height: 26px;
          font-size: 15px;
        }
      }
    }

    .icon-dropdown {
      .icon-tabs {
        .tab-item {
          padding: 10px 12px;
          font-size: 13px;
        }
      }
    }

    .icon-selector-warp-row {
      height: 160px !important;

      .icon-scroll-container {
        padding: 8px;
      }

      .icon-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
      }

      .icon-item {
        height: 36px;

        i,
        .menu-icon-svg {
          font-size: 16px;
          width: 16px;
          height: 16px;
        }
      }

      .icon-empty {
        .empty-icon {
          font-size: 36px;
        }

        .empty-text {
          font-size: 12px;
        }
      }
    }
  }
}

// 错误状态样式
.icon-selector-error {
  color: #f56c6c;
  font-size: 12px;
  padding: 8px 16px;
  background-color: #fef0f0;
  border: 1px solid #fbc4c4;
  border-radius: 4px;
  margin-top: 8px;
}

// 加载状态样式
.icon-selector-loading {
  color: #409eff;
  font-size: 12px;
  padding: 8px 16px;
  text-align: center;
  background-color: #f0f9ff;
  border: 1px solid #b3d8ff;
  border-radius: 4px;
  margin-top: 8px;
}

// 可访问性增强
.icon-selector-warp-item {
  &:focus {
    outline: 2px solid #409eff;
    outline-offset: 2px;
  }

  &:focus-visible {
    outline: 2px solid #409eff;
    outline-offset: 2px;
  }
}

// 暗色主题支持
@media (prefers-color-scheme: dark) {
  .icon-selector {
    .icon-dropdown {
      background-color: #1d1e1f;
      border: 1px solid #4c4d4f;
    }
  }
}
